package com.tfjybj.itoo.exam.provider.controller;

import com.dmsdbj.itoo.tool.business.ItooResult;
import com.github.pagehelper.PageInfo;
import com.tfjybj.itoo.exam.entity.DisciplineInfoEntity;
import com.tfjybj.itoo.exam.entity.ExamineeEntity;
import com.tfjybj.itoo.exam.model.*;
import com.tfjybj.itoo.exam.provider.service.DisciplineInfoService;
import com.tfjybj.itoo.exam.provider.service.ExaminationService;
import com.tfjybj.itoo.exam.provider.service.ExamineeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;

import static java.io.File.separator;


/**
 * DisciplineInfoController
 * disciplineInfo表
 *
 * @author 任晓帅
 * @version 2.0.0
 * @since 2.0.0 2018-11-15 19:40:28
 */
@Api(tags = {"disciplineInfo表接口"})
@RequestMapping(value = "/disciplineInfo")
@RestController
@Slf4j
public class DisciplineInfoController {

    @Resource
    private DisciplineInfoService disciplineInfoService;
    // 查询考场结束时间
    @Resource
    private ExaminationService examinationService;
    // 查询考生信息
    @Resource
    private ExamineeService examineeService;
    //region 模板生成：基本增删改

    /**
     * 添加
     *
     * @param model DisciplineInfoModel
     * @return 添加的结果
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "添加")
    @PostMapping(value = {"/create"})
    public ItooResult create(@RequestBody DisciplineInfoModel model) {
        DisciplineInfoEntity disciplineInfoEntity = new DisciplineInfoEntity();
        BeanUtils.copyProperties(model, disciplineInfoEntity);
        disciplineInfoService.saveOrUpdate(disciplineInfoEntity);
        return ItooResult.build(ItooResult.SUCCESS, "添加成功");
    }

    /**
     * 根据考试id查询违纪信息
     *
     * @param studentCode
     * @return
     * @author 于云秀
     * @since 2018年12月27日19:09:33
     */
    @ApiOperation(value = "根据考试id查询违纪信息")
    @GetMapping(value = {"/selectWj/{studentCode}"})
    public ItooResult selectWj(@ApiParam(value = "考试id ", required = true) @PathVariable String studentCode) {
        DisciplineInfoEntity disciplineInfoEntity = new DisciplineInfoEntity();
        List<DisciplineInfoModel> disciplineInfoModelList = disciplineInfoService.selectWj(studentCode);
        if (disciplineInfoModelList.size() > 0) {
            return ItooResult.build(ItooResult.SUCCESS, "查询成功", disciplineInfoModelList);
        } else {
            return ItooResult.build(ItooResult.FAIL, "", null);
        }

    }

    /**
     * 删除
     *
     * @param id 主键id
     * @return ItooResult 是否删除成功
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "根据id删除（单个）")
    @DeleteMapping(value = {"/delete/{id}"})
    public ItooResult delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
        disciplineInfoService.removeById(id);
        return ItooResult.build(ItooResult.SUCCESS, "删除成功");
    }

    /**
     * 批量删除
     *
     * @param ids ids
     * @return ItooResult 批量删除是否成功结果
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "根据id批量删除")
    @DeleteMapping(value = {"/deleteByIds"})
    @ApiImplicitParam(name = "ids", value = "ids", dataType = "List<String>", required = true)
    public ItooResult deleteByIds(@RequestBody List<String> ids) {
        disciplineInfoService.removeByIds(ids);
        return ItooResult.build(ItooResult.SUCCESS, "批量删除成功");
    }

    /**
     * 修改
     *
     * @param model DisciplineInfoModel
     * @return 修改后的结果
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "根据id修改disciplineInfo")
    @PutMapping(value = {"/modify"})
    public ItooResult modify(@RequestBody DisciplineInfoModel model) {
        DisciplineInfoEntity disciplineInfoEntity = new DisciplineInfoEntity();
        BeanUtils.copyProperties(model, disciplineInfoEntity);
        disciplineInfoService.updateById(disciplineInfoEntity);
        return ItooResult.build(ItooResult.SUCCESS, "修改成功");
    }

    /**
     * 根据id查找DisciplineInfo
     *
     * @param id 主键id
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "根据id查询")
    @GetMapping(value = {"/findById/{id}"})
    public ItooResult findById(@ApiParam(value = "主键id", required = true) @PathVariable String id) {
        DisciplineInfoEntity disciplineInfoEntity = disciplineInfoService.getById(id);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", disciplineInfoEntity);
    }

    /**
     * 分页查询所有DisciplineInfo
     *
     * @param pageNo   页码
     * @param pageSize 每页条数
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "分页查询所有DisciplineInfo")
    @GetMapping(value = {"/queryPageAll/{pageNo}/{pageSize}"})
    public ItooResult queryPageAll(@ApiParam(name = "pageNo", value = "页码", required = true, example = "1") @PathVariable Integer pageNo,
                                   @ApiParam(name = "pageSize", value = "页数", required = true, example = "10") @PathVariable Integer pageSize) {
        PageInfo<DisciplineInfoEntity> disciplineInfos = disciplineInfoService.queryPageAll(pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", disciplineInfos);
    }

    /**
     * 根据考试id模糊查询disciplineInfo
     *
     * @param examinationId 考试id
     * @param pageNo        页码
     * @param pageSize      页数
     * @return 模糊查询的disciplineInfo
     * @author 任晓帅
     * @since 2.0.0 2018-11-15 19:40:28
     */
    @ApiOperation(value = "根据考试id模糊查询disciplineInfo", notes = "分页根据考试id模糊查询disciplineInfo")
    @GetMapping(value = "queryDisciplineInfoByLikeExaminationId/{pageNo}/{pageSize}")
    public ItooResult queryDisciplineInfoByLikeExaminationId(@RequestParam(required = false, defaultValue = "") String examinationId,
                                                             @ApiParam(name = "pageNo", value = "页码", required = true, example = "1") @PathVariable Integer pageNo,
                                                             @ApiParam(name = "pageSize", value = "页数", required = true, example = "10") @PathVariable Integer pageSize) {
        PageInfo<DisciplineInfoEntity> disciplineInfoList = disciplineInfoService.queryByLikeExaminationId(examinationId, pageNo, pageSize);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", disciplineInfoList);
    }
    //endregion

    /* **********************************以下为非模板生成的内容********************************* */

    /**
     * 实时监控页面初始化加载考生信息
     *
     * @param
     * @return 考场内所有考生的实时答题信息
     * @author 李青松-魏恩君修改
     * @since 2.0.0 2018-11-25 19:28:00
     */
    @ApiOperation(value = "根据考场id考试id获取考场内所有考生的实时答题信息,默认题型为所有")
    @GetMapping(value = {"/queryStudentRealTime/{examRoomId}/{examID}"})
    public ItooResult queryStudentRealTime(@ApiParam(value = "考场id", required = true) @PathVariable String examRoomId, @ApiParam(value = "考试id", required = true) @PathVariable String examID) {
        if (StringUtils.isEmpty(examRoomId)) {
            return ItooResult.build(ItooResult.FAIL, "考场ID不能为空");
        }
        if (StringUtils.isEmpty(examID)) {
            return ItooResult.build(ItooResult.FAIL, "考试ID不能为空");
        }
        List<RealTimeModel> realTimeModelList = disciplineInfoService.queryStudentRealTime(examRoomId, examID);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", realTimeModelList);
    }

    /**
     * 根据搜索框查询考场内相应的考生(既有未登录又有已登录)
     *
     * @param studentNamekc
     * @param studentCode
     * @param state
     * @param examRoomId
     * @return ItooResult
     * @author 于云秀
     * @since 2018年12月19日
     */
    @ApiOperation(value = "根据搜索框查询考场内相应的考生")
    @GetMapping(value = "queryStudentInfo/{studentNamekc}/{studentCode}/{state}/{examRoomId}/{questionTypeID}/{studentClass}/{examId}")
    public ItooResult queryStudentInfo(@ApiParam(value = "学生姓名", required = true) @PathVariable String studentNamekc,
                                       @ApiParam(value = "学号", required = true) @PathVariable String studentCode,
                                       @ApiParam(value = "状态", required = true) @PathVariable String state,
                                       @ApiParam(value = "考场id", required = true) @PathVariable String examRoomId,
                                       @ApiParam(value = "题型id", required = true) @PathVariable String questionTypeID,
                                       @ApiParam(value = "班级", required = true) @PathVariable String studentClass,
                                       @ApiParam(value = "考试id", required = true) @PathVariable String examId) {
        try {
            if ("undefined".equals(studentNamekc)) {
                studentNamekc = "";
            }
            if ("undefined".equals(studentCode)) {
                studentCode = "";
            }
            if ("undefined".equals(state)) {
                state = "";
            }
            if ("undefined".equals(studentClass)) {
                studentClass = "";
            }
            if ("undefined".equals(questionTypeID)) {
                questionTypeID = "";
            }
            List<RealTimeModel> realTimeModelList = disciplineInfoService.queryStudentInfo(studentNamekc, studentCode, state, examRoomId, questionTypeID, studentClass, examId);
            if (realTimeModelList.size() > 0) {
                return ItooResult.build(ItooResult.SUCCESS, "查询成功", realTimeModelList);
            } else {
                return ItooResult.build(ItooResult.SUCCESS, "没有满足条件的考生！", realTimeModelList);
            }
        } catch (Exception e) {
            return ItooResult.build(ItooResult.FAIL, "查询失败！");
        }
    }

    /**
     * 延长考生考试时长
     *
     * @param ids
     * @param minute
     * @return
     * @author 于云秀
     * @since 2018年12月19日
     */
    @ApiOperation(value = "延长考生考试时长")
    @PostMapping(value = "updateTime/{ids}/{minute}/{examIdList}")
    public ItooResult updateTime(@ApiParam(value = "考生id", required = true) @PathVariable String[] ids,
                                 @ApiParam(value = "延长的时间", required = true, example = "10") @PathVariable int minute,
                                 @ApiParam(value = "考试id", required = true) @PathVariable List<String> examIdList) {
        // 1.查询考试结束时间
        // 2.for循环考生id获得相应的学生信息
        // 3.当前考生理论交卷时间+延长时间if(交卷时间+延长时间>=考试结束时间)更新else更新考试结束时间作为考生理论交卷时间

        //获取考试结束时间
        List<ExaminationModel> examinationModels = examinationService.selectExam(examIdList);
        //id为key值放到map中
        Map<String, ExaminationModel> examModelMap = examinationModels.stream().collect(
                Collectors.toMap(ExaminationModel::getId, model -> model));
        //存放延时失败的考生姓名
        List<String> result = new ArrayList<>();
        StringBuilder stringBuilder = new StringBuilder();
        // 循环考生sid查询每个考生的理论结束时间
        for (String id : ids) {
            ExamineeEntity examineeEntity = examineeService.getById(id);
            if (examineeEntity != null) {

                //相加后的时间(changeDate=当前理论交卷时间+延长时间)
                Date shouldSubmitTime = examineeEntity.getShouldSubmitTime();
                //创建一个默认的Calendar
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(shouldSubmitTime);
                //理论交卷时间+延长时间
                calendar.add(Calendar.MINUTE, minute);
                // 获取date对象
                Date changeDate = calendar.getTime();

                //考试结束时间
                Date examEndTime = examModelMap.get(examineeEntity.getExaminationId()).getEndTime();
                //延长时间<考试结束时间
                if (changeDate.before(examEndTime)) {
                    //更新为changeDate
                    examineeEntity.setShouldSubmitTime(changeDate);
                    //跟新考试时长
                    examineeEntity.setExamDuration(examineeEntity.getExamDuration() + minute);
                    //延长时间>考试结束时间
                } else {
                    //1.记录到list提示
                    //2.使用考试的结束时间examEndTime做为考生理论交卷时间

                    //考试结束时间作为延时后的交卷时间
                    examineeEntity.setShouldSubmitTime(examEndTime);
                    //考试时长=考试结束时间-抽卷时间
                    int duration = Math.toIntExact((examEndTime.getTime() - examineeEntity.getGetQuestionTime().getTime()) / 1000 / 60);
                    examineeEntity.setExamDuration(duration);
                    result.add("考生(" + examineeEntity.getStudentName() + ")延长" + minute + "分钟则超出考试时间范围,所以延长到(考试结束时间)");
                    // List转换为字符串并加入分隔符（张三/李四/王五）
                    for (int i = 0; i < result.size(); i++) {
                        stringBuilder.append(result.get(i)).append(separator);
                    }
                }
                examineeService.updateById(examineeEntity);
            }
        }
        return ItooResult.build(ItooResult.SUCCESS, "保存成功:" + stringBuilder);
    }

    /**
     * 根据考试id获取该考试下所有题型
     *
     * @param examID 考试ID
     * @return 题型集合
     * @author 魏恩君
     * @since 2.0.0 2018/12/22
     */
    @ApiOperation(value = "根据考试id获取该考试下所有题型")
    @GetMapping(value = "selectQuestionTypeByExamID/{examID}")
    public ItooResult selectQuestionTypeByExamID(@ApiParam(value = "考试ID", required = true) @PathVariable String examID) {
        if (StringUtils.isEmpty(examID)) {
            log.warn("获取该场考试所有题型时考试ID为空");
            return ItooResult.build(ItooResult.SUCCESS, "考试ID不能为空");
        }
        List<QuestionTypeModel> list = disciplineInfoService.selectQuestionTypeByExamID(examID);
        return ItooResult.build(ItooResult.SUCCESS, "题型查询成功", list);
    }

    /**
     * 添加缺考信息
     *
     * @param
     * @return
     * @author 魏恩君
     * @since 2.0.0 2018/12/22
     */
    @ApiOperation(value = "添加缺考信息")
    @GetMapping(value = "addMissingExamInf")
    public ItooResult addMissingExamInf(@RequestParam(required = true, defaultValue = "") String examineeId, @RequestParam(required = true, defaultValue = "") String absentInfo) {
        if (StringUtils.isEmpty(examineeId)) {
            log.warn("添加缺考信息考生号为空");
            return ItooResult.build(ItooResult.FAIL, "考生号不能为空");
        }
        if (StringUtils.isEmpty(absentInfo)) {
            log.warn("添加缺考信息缺考信息为空");
            return ItooResult.build(ItooResult.FAIL, "缺考信息不能为空");
        }
        try {
            Boolean isSuccess = disciplineInfoService.addExamMissingInf(examineeId, absentInfo);
            if (isSuccess) {
                return ItooResult.build(ItooResult.SUCCESS, "添加缺考信息成功");
            } else {
                return ItooResult.build(ItooResult.FAIL, "添加缺考信息失败");
            }
        } catch (Exception e) {
            log.error("添加缺考信息失败");
            return ItooResult.build(ItooResult.FAIL, "添加缺考信息失败");
        }
    }


    /**
     * 在线监控（饼状图）根据考场id查询所有考试学生信息
     *
     * @param
     * @return 考场内所有考生的实时答题信息
     * @author 魏恩君
     * @since 2.0.0 2018年12月23日11:28:10
     */
    @ApiOperation(value = "在线监控（饼状图）根据考场id查询所有考试学生信息")
    @GetMapping(value = {"/queryAllStudent/{examRoomId}/{examId}"})
    public ItooResult queryAllStudent(@ApiParam(value = "考场id", required = true) @PathVariable String examRoomId,
                                      @ApiParam(value = "考试id", required = true) @PathVariable String examId) {
        if (StringUtils.isEmpty(examRoomId)) {
            return ItooResult.build(ItooResult.FAIL, "考场ID不能为空");
        }
        if (StringUtils.isEmpty(examId)) {
            return ItooResult.build(ItooResult.FAIL, "考试ID不能为空");
        }
        //根据考场id、考试id查询所有考试学生信息
        List<RealTimeModel> allStudentList = disciplineInfoService.queryAllStudent(examRoomId, examId);
        return ItooResult.build(ItooResult.SUCCESS, "查询成功", allStudentList);
    }


    /**
     * 根据搜索框查询已登录后的考生信息-魏恩君-2018年12月26日
     *
     * @param studentNamekc
     * @param studentCode
     * @param state
     * @param examRoomId
     * @return ItooResult
     * @author 魏恩君
     * @since 2018年12月26日
     */
    @ApiOperation(value = "根据搜索框查询已登录后的考生信息")
    @GetMapping(value = "queryLoginedInf/{studentNamekc}/{studentCode}/{state}/{examRoomId}/{questionTypeID}/{studentClass}/{examId}")
    public ItooResult queryLoginedInf(@ApiParam(value = "学生姓名", required = false) @PathVariable String studentNamekc,
                                      @ApiParam(value = "学号", required = false) @PathVariable String studentCode,
                                      @ApiParam(value = "状态", required = false) @PathVariable String state,
                                      @ApiParam(value = "考场id", required = false) @PathVariable String examRoomId,
                                      @ApiParam(value = "题型id", required = false) @PathVariable String questionTypeID,
                                      @ApiParam(value = "班级", required = false) @PathVariable String studentClass,
                                      @ApiParam(value = "考试id", required = false) @PathVariable String examId) {

            if ("undefined".equals(studentNamekc)) {
                studentNamekc = "";
            }
            if ("undefined".equals(studentCode)) {
                studentCode = "";
            }
            if ("undefined".equals(state)) {
                state = "";
            }
            if ("undefined".equals(studentClass)) {
                studentClass = "";
            }
            if ("undefined".equals(questionTypeID)) {
                questionTypeID = "";
            }
            List<RealTimeModel> realTimeModelList = disciplineInfoService.queryLoginedInf(studentNamekc, studentCode, state, examRoomId, questionTypeID, studentClass, examId);
            if (realTimeModelList.size() > 0) {
                return ItooResult.build(ItooResult.SUCCESS, "查询成功", realTimeModelList);
            } else {
                return ItooResult.build(ItooResult.SUCCESS, "没有满足条件的考生！", realTimeModelList);
            }
    }


    /**
     * 根据搜索框查询未登录的考生信息-魏恩君-2018年12月26日
     *
     * @param studentNamekc
     * @param studentCode
     * @param state
     * @param examRoomId
     * @return ItooResult
     * @author 魏恩君
     * @since 2018年12月26日
     */
    @ApiOperation(value = "根据搜索框查询未登录的考生信息")
    @GetMapping(value = "queryNotLoginInf/{studentNamekc}/{studentCode}/{state}/{examRoomId}/{questionTypeID}/{studentClass}/{examId}")
    public ItooResult queryNotLoginInf(@ApiParam(value = "学生姓名", required = true) @PathVariable String studentNamekc,
                                       @ApiParam(value = "学号", required = true) @PathVariable String studentCode,
                                       @ApiParam(value = "状态", required = true) @PathVariable String state,
                                       @ApiParam(value = "考场id", required = true) @PathVariable String examRoomId,
                                       @ApiParam(value = "题型id", required = true) @PathVariable String questionTypeID,
                                       @ApiParam(value = "班级", required = true) @PathVariable String studentClass,
                                       @ApiParam(value = "考试id", required = true) @PathVariable String examId) {

            if ("undefined".equals(studentNamekc)) {
                studentNamekc = "";
            }
            if ("undefined".equals(studentCode)) {
                studentCode = "";
            }
            if ("undefined".equals(state)) {
                state = "";
            }
            if ("undefined".equals(studentClass)) {
                studentClass = "";
            }
            if ("undefined".equals(questionTypeID)) {
                questionTypeID = "";
            }
            List<RealTimeModel> realTimeModelList = disciplineInfoService.queryNotLoginInf(studentNamekc, studentCode, state, examRoomId, questionTypeID, studentClass, examId);
            if (realTimeModelList.size() > 0) {
                return ItooResult.build(ItooResult.SUCCESS, "查询成功", realTimeModelList);
            } else {
                return ItooResult.build(ItooResult.SUCCESS, "没有满足条件的考生！", realTimeModelList);
            }
    }

    /**
     * 实时监控简单查询
     *
     * @param search
     * @param examId
     * @param examRoomId
     * @return
     * @author 于云秀
     * @since 2019年1月4日
     */
    @ApiOperation(value = "实时监控简单查询")
    @GetMapping(value = "selectExamineeInfo/{search}/{examId}/{examRoomId}")
    public ItooResult selectExamineeInfo(@ApiParam(value = "搜索框数据", required = true) @PathVariable String search,
                                         @ApiParam(value = "考试id", required = true) @PathVariable String examId,
                                         @ApiParam(value = "考场id", required = true) @PathVariable String examRoomId) {
        List<RealTimeModel> realTimeModelList = disciplineInfoService.selectExamineeInfo(search, examId, examRoomId);
        if (realTimeModelList.size() > 0) {
            return ItooResult.build(ItooResult.SUCCESS, "成功！", realTimeModelList);
        }
        return ItooResult.build(ItooResult.FAIL, "没有满足条件的考生！");
    }

    /**
     * 查询监考老师
     *
     * @param examId
     * @param examRoomId
     * @return
     * @author 于云秀
     * @since 2019年1月4日
     */
    @ApiOperation(value = "查询监考老师")
    @GetMapping(value = "selectExamineeInfo/{examId}/{examRoomId}")
    public ItooResult selectTeacherInfo(@ApiParam(value = "考试id", required = true) @PathVariable String examId,
                                        @ApiParam(value = "考场id", required = true) @PathVariable String examRoomId) {
        List<ExamRoomModel> examRoomModellList = disciplineInfoService.selectTeacherInfo(examId, examRoomId);
        if (examRoomModellList.size() > 0) {
            return ItooResult.build(ItooResult.SUCCESS, "查询老师成功！", examRoomModellList);
        }
        return ItooResult.build(ItooResult.FAIL, "失败！");
    }

    /**
     * 批量添加缺考信息-魏恩君-2019年1月3日
     *
     * @param notLoginIds
     * @param absentInfo
     * @return ItooResult
     * @author 魏恩君
     * @since 2019年1月3日16:57:18
     */
    @ApiOperation(value = "批量添加缺考信息")
    @GetMapping(value = "batchAddNotLogin/{notLoginIds}/{absentInfo}")
    public ItooResult batchAddNotLogin(@ApiParam(value = "考生id", required = false) @PathVariable String notLoginIds,
                                       @ApiParam(value = "缺考信息", required = false) @PathVariable String absentInfo) {
        //根据考生id更新缺考信息
        Boolean flag = disciplineInfoService.batchAddNotLogin(notLoginIds, absentInfo);
        // 返回true添加成功
        if (flag) {
            return ItooResult.build(ItooResult.SUCCESS, "批量添加缺考信息成功");
            //添加失败
        } else {
            return ItooResult.build(ItooResult.FAIL, "批量添加缺考信息失败");
        }
    }

    /**
     * 查询正在考试的考试信息
     *
     * @return ItooResult
     * @author 车龙梁
     * @since 2019年1月3日16:57:18
     */
    @ApiOperation(value = "实时监控")
    @GetMapping(value = "selectExaminationInfo/{operator}")
    public ItooResult selectExaminationInfo(@ApiParam(value = "教师id", required = false) @PathVariable String operator) {
        //根据登录人查询监考以及创建的进行中考试
        List<ExaminationInfoModel> examinationInfoModels = disciplineInfoService.selectExaminationInfo(operator);
        // 有考试
        if (examinationInfoModels.size() > 0) {
            return ItooResult.build(ItooResult.SUCCESS, "查询成功", examinationInfoModels);
            // 无考试
        } else {
            return ItooResult.build(ItooResult.FAIL, "查询失败");
        }
    }

}
